﻿// -----------------------------------------------------------------------
// <copyright file="Notification.cs" company="Zen Design Corp">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Zen.BlackBerry.Acknowledgement
{
	using Zen.BlackBerry.Pap.Parser;

	/// <summary>
	/// Represents a PAP result notification along with additional details
	/// associated with this notification.
	/// </summary>
	public class Notification : ResultNotification
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="Notification"/> class.
		/// </summary>
		public Notification()
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="Notification"/> class.
		/// </summary>
		/// <param name="resultNotification">The result notification.</param>
		public Notification(ResultNotification resultNotification)
		{
			Address = resultNotification.Address;
			EventTime = resultNotification.EventTime;
			Code = resultNotification.Code;
			Description = resultNotification.Description;
			SenderAddress = resultNotification.SenderAddress;
			SenderName = resultNotification.SenderName;
			MessageState = resultNotification.MessageState;
			PushId = resultNotification.PushId;
			ReceivedTime = resultNotification.ReceivedTime;
			QualityOfService = resultNotification.QualityOfService;
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="Notification"/> class.
		/// </summary>
		/// <param name="resultNotification">The result notification.</param>
		/// <param name="pushApplicationId">The push application id.</param>
		public Notification(
			ResultNotification resultNotification, string pushApplicationId)
			: this(resultNotification)
		{
			PushApplicationId = pushApplicationId;
		}

		/// <summary>
		/// Gets or sets the push application id.
		/// </summary>
		/// <value>The push application id.</value>
		public string PushApplicationId
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the address count.
		/// </summary>
		/// <value>The address count.</value>
		public int? AddressCount
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets a boolean value indicating whether this notification
		/// is the last one sent for the associated push-id.
		/// </summary>
		/// <value>
		/// <c>true</c> if this is the last notification; otherwise, <c>false</c>.
		/// </value>
		public bool IsLast
		{
			get;
			set;
		}
	}
}
